package com.devbobcorn.nekoration.common.event;

import com.devbobcorn.nekoration.Nekoration;
import com.devbobcorn.nekoration.debug.DebugCommand;
import com.devbobcorn.nekoration.utils.TradeHelper;
import com.mojang.brigadier.CommandDispatcher;

import net.minecraft.command.CommandSource;
import net.minecraft.entity.merchant.villager.VillagerProfession;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.village.VillagerTradesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;

@EventBusSubscriber(modid = Nekoration.MODID, bus = EventBusSubscriber.Bus.FORGE)
public class CommonForgeEventSubscriber {
    @SubscribeEvent
	public static void onRegisterCommands(RegisterCommandsEvent event) {
		CommandDispatcher<CommandSource> commandDispatcher = event.getDispatcher();
		
		DebugCommand.register(commandDispatcher);
	}

	@SubscribeEvent
	public static void onRegisterTrades(VillagerTradesEvent event) {
		if (event.getType() == VillagerProfession.LIBRARIAN) {
			event.getTrades().get(1).add(new TradeHelper.BrochureForEmeralds(1));
		}
	}
}
